from random import choice

class RandomWork():
    '''随机运动类'''

    def __init__(self, num_points=10000):
        '''初始化'''

        self.num_point = num_points
        self.x_values = [0]
        self.y_values = [0]

    def get_step(self):
        '''获取路径移动位置'''

        direction = choice([1, -1])
        distance = choice([0, 1, 2, 3, 4])
        step = direction * distance
        return step

    def fill_work(self):
        '''计算漫步包含所有点'''
        while len(self.x_values) < self.num_point:
            x_step = self.get_step()
            y_step = self.get_step()

            next_x = self.x_values[-1] + x_step
            next_y = self.y_values[-1] + y_step

            self.x_values.append(next_x)
            self.y_values.append(next_y)